import { request } from '../../../../services/request';

// 获取所有部门/车间
export const getAllDept = async (params: { type: number; device_name: string }) => {
    return request('/app/dept/getAllDept', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 获取车间资源组调度信息
export const getRoomResourceGroupScheduler = async (params: { room_id: string }) => {
    return request('/app/scheduler/getRoomResourceGroupScheduler', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 搜索工单
export const searchWorkOrder = async (params: { keyword: string; current: number; size: number }) => {
    return request('/app/workOrder/searchWorkOrder', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 获取批次列表
export const getAssignmentBatchOrderList = async (params: { work_order_id: string }) => {
    return request('/app/assignment/getAssignmentBatchOrderList', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 获取工序列表
export const getAssignmentMesTaskList = async (params: { batch_order_num: string }) => {
    return request('/app/assignment/getAssignmentMesTaskList', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 获取工序详情信息
export const getTaskInfo = async (params: { id: string; batch_order_num: string }) => {
    return request('/app/assignment/getTaskInfo', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

// 派工提交
export const submitAssignmentTask = async (params: {
    id: string;
    batch_order_num: string;
    work_start: string;
    work_end: string;
    work_device_id?: string;
    work_station_id?: string;
    work_user_id?: string;
    work_line_id?: string;
    capacity: number;
}) => {
    return request('/app/assignment/assignmentTask', {
        method: 'POST',
        body: JSON.stringify(params)
    });
};

